package com.jiu345.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jiu345.api.mapper.BannerMapper;
import com.jiu345.api.mapper.BrandMapper;
import com.jiu345.api.mapper.CategoryBrandMapper;
import com.jiu345.api.pojo.Banner;
import com.jiu345.api.pojo.Brand;
import com.jiu345.api.pojo.CategoryBrand;
import com.jiu345.api.service.IBannerService;
import com.jiu345.api.service.IBrandService;
import com.jiu345.core.page.PageQuery;
import com.jiu345.core.page.TableDataInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * package:IGoodsCateServiceImpl
 * @author MrLei QQ:235921049
 * @date 2024-05-21
 * desc:商品分类
 */
@RequiredArgsConstructor
@Service
public class IBrandServiceImpl implements IBrandService {
    private final BrandMapper baseMapper;
    private final CategoryBrandMapper categoryBrandMapper;

    /*商品分类一级*/
    @Override
    public TableDataInfo<Brand> queryPageList(Brand bo, PageQuery pageQuery) {
        LambdaQueryWrapper<Brand> wrapper = new LambdaQueryWrapper<>(bo);
        //查询所有分类列表
        List<Brand> result = baseMapper.selectList(wrapper);
        //用层级封装组件重新封装后返回
        return TableDataInfo.build(result);
    }
    /*根据分类id查询品牌*/
    @Override
    public TableDataInfo<CategoryBrand> selectByCategoryIdPageList(CategoryBrand bo, PageQuery pageQuery) {

        return categoryBrandMapper.selectByCategoryIdPageList(bo,pageQuery);
    }
}
